package com.zerosky.crm.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.zerosky.crm.dao.OperateLogDAO;
import com.zerosky.crm.po.OperateLog;
import com.zerosky.crm.service.OperateLogService;
import com.zerosky.crm.util.PageInfo;

/**
 * Activity业务逻辑实现类
 * 
 * @author hugy;
 * @since 2017-06-08
 *
 */
@Service(value="operateLogService")
public class OperateLogServiceImpl implements OperateLogService {

	@Autowired
	private OperateLogDAO operateLogDAO; // Activity数据接口


	@Override
	public PageInfo<OperateLog> getOperateLogList(Map map) {
		int begin = (((int)map.get("page") - 1) * (int)map.get("pageSize"));
		PageInfo<OperateLog> page=new PageInfo<OperateLog>();
		// 写入数据
		map.put("pageNo", begin);
		List<OperateLog> list =  operateLogDAO.getOperateLogList(map);
		page.setList(list);

		int count = operateLogDAO.countOperateLog(map);// 获取总记录
		page.setPageCount(count);
		return page;
	}


	@Override
	public int addOperateLog(OperateLog operateLog) throws Exception {
		return operateLogDAO.addOperateLog(operateLog);
	}
}
